home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload Trio 2
/
Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO
/
dir35
/
cusort31.zip
/
CUSORT.DOC
next >
Wrap
Text File
|
1993-06-22
|
11KB
|
245 lines
| Colorado Utilities Sort (CUSORT v.3)
|
| by
|
| Fred C. Hill
|
| Micro System Solutions
| 5048 W. Maplewood Ave.
| Littleton, CO 80123
| 1-(303) 795-7653
| 1-(800) 421-1789 (orders)
|
Sorting is one of those things every computer user must do at one time or
another, and the sort program provided with most versions of DOS just
doesn't do the job. It's slow; only sorts from column one; won't sort
descending; has a limited capacity; and only uses regular memory to sort in.
Not a very useful program when you have hundreds of thousands of records you
want sorted in position 25 for 12 characters.
CUSort implements what is known as a virtual sort, allowing you to sort more
than will fit in RAM at one time. It does this by sorting manageable
portions of the input file first, and then merging these pre-sorted lists to
form the final output file. In theory, two billion records can be sorted in
one run. In actual practice, the number of records will be limited only by
the amount of available disk or expanded memory (EMS) capacity, and, of
course, the amount of time you're willing to wait.
System Statistics.
During the modifications, seceral large test files were prepared and sorted
using CUSORT. The results show that the larger the file, the greater the
exponential increase in sorting time. For example. When sorting a 500K
file of 80 character records it took approximately 50 seconds or 10K
records per second. A 1,000K file took approx 108 seconds or 9K records
per second. A 4,000K file took 17 minutes 55 seconds (1075 seconds) or
3.7K records per second. These figures where compiled on a 486 33mHz PC
with 16 meg of memory. Larger files will take a proportionately longer
period of time.
CuSort Revision history
version 3.1 - June 1993
o Added an activity indicator on the screen while sorting. This will
ensure users know that sort is operating.
o Added an option (#) to allow users to alter the sort buffer size to
fine tune sorting. Changing this parameter normally provides a small
1 or 2 second change in sorting times. The maximum allowed is 64 (K).
version 3.0 - June 1993
o Added an option (F) to sort fixed length records. These records
typically have no CR/LF separator and are written by BASIC, COBOL
etc.
o Changed the file parameter from piped in/out to regular file I/O to
support fixed length records.
version 2.3 - April 1993
o Fixed the comparison routine to give proper results when two records
of different lengths are processed. Prior to v2.3 the compare terminated
at the length of the longer record. All record lengths are now padded
to the length of the larger prior to testing equality. Thanks to
Ray Schildknecht for the bug report.
o Added the capability to sort individual fields in decending mode. See
use documentation for details.
version 2.2 - November 1992
o Fixed a bug in the parameter parsing which would not set the descending
sort option properly.
Changed the version number to x.x vs x.xx
version 2.16 - February 1992
o Added the quiet mode operation (/Q) at the request of Dave Holley of
MicroMax Computer Services Corp.
version 2.1 - November 1990
o Option E added. Do not use Expanded memory even if available.
o At an abnormal termination CuSort now removes its work files.
o Bugs fixed -
o Option L flag was never initialized so it could be invoked at any
time by leftover memory contents.
o StdIn was not always used properly.
o The D (remove duplicates) & L (sort by length) options were added at
the request of Terry Hall of Illinois. This addition allowed me to
find the /B option bug also.
version 2.0 - August 1990
o Option D Directory changed to Option R Redirect.
o Option D Added to indicate "No duplicates to be written."
o Option L added to indicate "Sort by record length."
o Bug fixed - if blank record option (/B) not selected the program would
not produce an output file.
CUSort's operation is determined by the command line parameters you
give it when the program is started. The command line format is
CuSort [options] <inputFile >outputFile
Options:
/- Sort all fields in descending order. The default is
ascending order. See the /S command to sort an
individual field in descending order. When sorting by
fields (/S command) this parameter will result in the
entire file being sequenced in descending order from
the major sort field to the minor sort field.
/# Change sort buffer size. The input is in K (1024
character blocks) and the range is 1 to 64. This was
added for product testing and its use is arbitrary and
not recommended. The system will default to 24K
/B Do not write blank records. All blank records
found during the input phase will be discarded.
/C xxx Set maximum record size to xxx. This will allow CUSORT
to allocate a fixed record size and make the sort more
effecient. Only use this option if you know absolutly
what the maximum record size is.
/D Do not write duplicate records.
/E Do not use Expanded Memory (EMS) even if that memory
is available.
/F xxx Set the size of a fixed length record. Some languages
do not write a CR/LF for some file types. In BASIC, for
example, a file opened for Random processing does not
get CR/LF's. By using the F option you can sort these files
as you would a normal text file.
/L Sort by length of record. /S parm is ignored.
/I Ignore upper/lower case. All input is compared
as if it were upper case.
/Q Run in quiet mode. No output is made to the StdErr
file. (StdErr is normally defined to the screen)
/R xx Redirect temporary sort files to directory
xx. (files will be deleted before program
terminates.)
/S c,l[-]
Sort fields ... c = column; l = length. You may
have a maximum of 6 /S fields during any single
run. They must be placed in priority sort order.
Placing a minus sign '-' anywhere in the parameter
will cause that field to be sorted in descending
order.
/T Trim records. This parameter allows you to
remove blanks at the beginning and end of the
input records. Sequencing is done prior to
trimming.
Caution: When using the descending options, the option can only be
set once for each field. If you use the global [/-] option
and then set a sort field in descending or [/S c,l-] the
sequence will still be descending. In other words, using both
options will not reverse the ordering.
Examples:
CuSort /B /S 1,25 textin.dat textout.dat
This example sorts just like the DOS sort except that the
sort field size is limited to 25 characters and any blank
records found during sorting will not be included in the
output file.
CuSort /- /I textin.dat textout.dat
This example sorts the entire file, including blank
records in descending sequence. Lower case and Upper case
are sorted together.
CuSort /I /S 10,5- /S 2,6 textin.dat textout.dat
This example sorts on column 10 for 5 characters as the
major sort field (descending order) and column 2 for 6
characters as the minor sort field (ascending order).
Upper and lower case characters are sorted together.
CuSort /- /I /S 10,5 /S 2,6 textin.dat
This example sorts on column 10 for 5 characters as the
major sort field (descending order) and column 2 for 6
characters as the minor sort field (ascending order). The
entire file is sorted in descending sequence and upper and
lower case characters are sorted together. Since no output
file name was included it will be named "TEXTIN.SRT".
CuSort /L /D /Q <textin >textout
This example will sort records by length of record and
will remove any duplicate records. Operate in quiet mode
ORDER FORM
Name: ------------------------------------------------------
Address: ---------------------------------------------------
City: ---------------------------- State: ---- Zip: --------
Phone: ( ) -------------------------------
Credit card: type - Visa Mastercard
Card number: ------------------------------ expires ---/---
Name on card: ---------------------------------------------
----------------------------------------------------------------
CuSort latest version . . . . . . . . . . . . . . . $ 24.00
Includes the following..
Current disk direct from author
Telephone support
Notification of further upgrades and
products.
Colorado residents include 3% state tax and
appropriate local tax. . . . . . . . . . . . . .$ -----
Shipping & Handling . . . . . . .$ 5.00
Total included . . . . . . . . .$ -----
----------------------------------------------------------------
Order in one of three ways... Fill out this form and mail to:
Micro System Solutions
5417 S. Cimarron Rd.
Littleton, CO 80123
- or -
Call 1-(800) 421-1789 or 1-(300) 795-7653 (credit card orders)
- or-
Leave a Compuserve CMail (Compuserve Mail) message for
Micro System Solutions (Fred C. Hill PPN 76060,102) with all
of the information above. (credit card orders or information
only please, DO NOT leave messages with credit card numbers
in the forum areas)
----------------------------------------------------------------